import { parseTime } from "@/utils/ruoyi";
import { ElMessage } from "element-plus";

export function useColumns() {
  return [
    {
      prop: "name",
      label: "名字",
      rules: [
        {
          required: true,
          message: "请输入名字",
        },
      ],
    },
    {
      prop: "code",
      label: "code",
      search: true,
      rules: [
        {
          required: true,
          message: "请输入code",
        },
      ],
    },
    {
      type: "upload",
      prop: "url",
      label: "附件",
      action: "/api/upload",
      dataType: "string",
      limit: 1,
      span: 24,
      hide: true,
      uploadExceed() {
        ElMessage.error("最多上传1个附件");
      },
    },
    {
      prop: "createTime",
      label: "创建时间",
      display: false,
      formatter: (row: any) => {
        return parseTime(row.createTime);
      },
    },
  ];
}
